package com.hksj.aqm.controller;

import com.hksj.aqm.query.DayPm25Query;
import com.hksj.aqm.query.Pm25Query;
import com.hksj.aqm.service.Pm25Service;
import com.hksj.aqm.vo.AqmCalendarVO;
import com.hksj.aqm.vo.Pm25RateVO;
import com.hksj.common.core.model.Rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "空气质量-pm2.5指数接口")
@RequestMapping("/api/aqm/pm25")
@RestController
public class Pm25Controller {
    @Autowired
    private Pm25Service pm25Service;

    @ApiOperation("大屏-pm2.5指数级别占比")
    @PostMapping("/listPm25Rate")
    public Rest<List<Pm25RateVO>> listPm25Rate(@RequestBody Pm25Query query){
        List<Pm25RateVO> list = pm25Service.listPm25Rate(query);
        return Rest.ok(list);
    }

    @ApiOperation("大屏-空气质量日历")
    @PostMapping("/listDayPm25Index")
    public Rest<AqmCalendarVO> listDayPm25Index(@RequestBody @Validated DayPm25Query query){
        AqmCalendarVO aqmCalendarVO = pm25Service.listDayPm25Index(query);
        return Rest.ok(aqmCalendarVO);
    }
}
